package com.example.demo.controller;


import com.example.demo.entity.SchoolStudent;
import com.example.demo.entity.vo.ResultVO;
import com.example.demo.service.SchoolStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * (SchoolStudent)表控制层
 *
 * @author makejava
 * @since 2022-07-30 14:38:08
 */
@RestController
@RequestMapping("/school_students")
public class SchoolStudentController {

    @Autowired
    private SchoolStudentService schoolStudentService;

    @GetMapping("/girl_info")
    public ResultVO getAllGirl(){
        return ResultVO.ok(schoolStudentService.getAllGirl());
    }

    @PostMapping
    public ResultVO addStudent(@RequestBody SchoolStudent schoolStudent){
        schoolStudentService.save(schoolStudent);

        return ResultVO.ok();
    }

    @GetMapping("/dept-count/{dept}")
    public ResultVO deptCout(@PathVariable String dept){


        return ResultVO.ok(schoolStudentService.deptCout(dept));
    }
}

